package com.zmovie.admin.config;

import com.zmovie.admin.interceptor.AdminLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 挚爱之夕
 * @version 1.0
 * @implSpec 配置
 * @since 2023-11-27 19:29
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    //配置拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //后台
        registry.addInterceptor(new AdminLoginInterceptor())
                .addPathPatterns("/**")
                //放行登录页面
                .excludePathPatterns("/login.do")
                //放行登录请求
                .excludePathPatterns("/login")
                //放行静态资源
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/images/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/lib/**")
                .excludePathPatterns("/cert/**")
                .order(1);
    }
}
